/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						      minimum_maximum.h

	$Header: $

	$NoKeywords: $

 ************************************************************************/

#if !defined( MINIMUM_MAXIMUM_H_INCLUDED )
#define MINIMUM_MAXIMUM_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


// --------------------------------------------------------
// Replacements for std::min & std::max. Visual C++ does
// not include the standard-required versions of min & max,
// and wants you to use non-standard _MIN and _MAX (or 
// std::cpp_min & std::cpp_max). To avoid all this 
// non-standardness, we just have our own versions.
// --------------------------------------------------------
template< class t_type > inline
	t_type const & maximum( t_type const & x, t_type const & y )
{
	return (x < y ? y : x); 
}

template<class t_type, class t_pred> inline
	t_type const & maximum( t_type const & x, t_type const & y, t_pred pred )
{
	return (pred(x, y) ? y : x); 
}

template<class t_type> inline
	t_type const & minimum( t_type const & x, t_type const & y )
{
	return (y < x ? y : x); 
}

template<class t_type, class t_pred> inline
	t_type const & minimum( t_type const & x, t_type const & y, t_pred pred )
{
	return (pred(y, x) ? y : x); 
}



#endif // MINIMUM_MAXIMUM_H_INCLUDED